import React, { useState, useEffect } from 'react'
import { reqShangP } from '../../../../request/api'
export default function ShangP() {
    let [arr, setArr] = useState([])
    useEffect(() => {
        reqShangP().then(res => {
            setArr(res.list[0].content)
        })
    }, [])
    return (
        <div className="shangpin">
            <ul>
                {
                    arr.map(item => {
                        return (
                            <li key={item.id}>
                                <img src={item.img} alt="" />
                                <div>
                                    <p>{item.goodsname}</p>
                                    <p>直降198元，限购一件</p>
                                    <p>{item.price}</p>
                                    <p>{item.market_price}</p>
                                    <span>加入购物车</span>
                                </div>
                                
                            </li>
                        )
                    })
                }

            </ul>
        </div>
    )
}
